package crafex.resource.items.gunparts;

import java.util.ArrayList;

import crafex.engine.entities.InventoryItem;
import crafex.engine.tools.IDS;
import crafex.engine.tools.IntVertex2D;
import crafex.engine.tools.Tools;
import crafex.resource.items.Gun.GunTypes;


public abstract class GunPart extends InventoryItem{

	protected String brandID;
	protected String s_brandID = "-brandid=";
	protected String name;
	protected String s_name = "-name=";
	protected String imagefilename;
	protected String s_image = "-image=";
	public int rareChance;
	public String s_rareChance = "-rarechance=";
	
	protected boolean waterproof;
	protected boolean g_waterproof;
	protected String s_waterproof;
	
	protected GunTypes guntype;
	
	public GunPart(int id, IntVertex2D length) {
		super(IDS.GunPart, new IntVertex2D(1, 1));
	}
	
	public void gen(){
		int randomint = Tools.getRandomInt(1, 1);
		
		switch(randomint){
		case 1:
			guntype = GunTypes.pistol;
		}
	}
	
	public String getSave(){
		
		ArrayList<String> data = new ArrayList<String>();
		
		data.add(brandID);
		
		if(guntype == GunTypes.pistol){
			data.set(0, data.get(0) + "p");
		}
		
		
		
		return null;
	}

	public String getBrandID() {
		return brandID;
	}


	public void setBrandID(String brandID) {
		this.brandID = brandID;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}

	public abstract String[] save(String name);
	public abstract void load(String[] save);
	public abstract void generate(int level);
}
